package com.lsp.base.utils.rxpreference;

import android.app.Application;
import android.content.Context;
import com.f2prateek.rx.preferences.RxSharedPreferences;

/**
 * sharepreference
 *
 * @author com.lsp.ibxs
 * @created 16/11/11 10:50
 */
public class GlobalPreferencesManager {

  private static GlobalPreferencesManager INSTANCE;
  public static final String GLOBAL_PREFERENCE_NAME = "ibxs-preferences";
  public static final String BXINSURANCE = "ibxs-bxinsurance";
  private JsonConverter mJsonConverter;
  private RxSharedPreferences mPreference;

  public static GlobalPreferencesManager getInstance() {
    if (INSTANCE == null) {
      INSTANCE = new GlobalPreferencesManager();
    }
    return INSTANCE;
  }

  public GlobalPreferencesManager() {
    mJsonConverter = JsonConverterProvider.jsonConverter();
  }

  public void init(Application application) {
    mPreference = RxSharedPreferences.create(
        application.getSharedPreferences(GLOBAL_PREFERENCE_NAME, Context.MODE_PRIVATE));
  }

}
